﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Globalization;

namespace MobileOSMLib
{
    public class GoogleUrlBuilder : MapUrlBuilder
    {
        private string _mapType = "mobile";

        #region public properties
        private string _apiKey = string.Empty;

        /// <summary>
        /// Maptype to use in url
        /// </summary>
        public string MapType
        {
            get
            {
                return _mapType;
            }
            set
            {
                _mapType = value;
            }
        }

        /// <summary>
        ///  API key to use in url
        /// </summary>
        public string GoogleMapsAPIKey
        {
            get
            {
                return _apiKey;
            }
            set
            {
                _apiKey = value;
            }
        }
        #endregion

        /// <summary>
        /// The resulting url
        /// </summary>
        public string MapUrl
        {
            get
            {
                return String.Format(CultureInfo.InvariantCulture,
                    "http://maps.google.com/staticmap?center={0},{1}&size={5}x{6}&zoom={2}&maptype={3}",
                    _coordinate.Latitude, _coordinate.Longitude, _zoomLevel, _mapType, _apiKey, _xSize, _ySize);
            }
        }

        /// <summary>
        ///  Default string representation
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return MapUrl;
        }

    }
}
